#include "fig_miniboss_hulk.h"
#include "fig_enemybullet_master.h"
#include "fighter.h"

#include "num/rand.h"
#include "math/facing.h"



FIGMiniBossHulk::FIGMiniBossHulk(FIGEnemyCraft::ENEMY_TYPES EnemyType) : 
							FIGEnemyMiniBoss(										
										EnemyType
										)
{
	
	m_Accel = 1.0f;	
		
	

}

void		FIGMiniBossHulk::Tick_RotateBack(float dt)
{
	float Step = 180.0f * dt ;
	
    if(m_RotateBackDegree <= 180)
	{
		if(m_RotateBackClockWise)
			m_Rotation += Step;
		else
			m_Rotation -= Step;

		m_RotateCounter += Step;   

		if(m_Rotation > 360)
			m_Rotation -= 360;
		if(m_Rotation < 0)
			m_Rotation += 360;
	}

	
	if( m_RotateCounter >= m_RotateBackDegree )
		m_MiniBossState = MINIBOSS_STATE_GOBACK;

	
	GoForward(dt);

	
}

void		FIGMiniBossHulk::ReSpawn()
{
	FIGEnemyMiniBoss::ReSpawn();
	m_RotateCounter = 0;

	m_RotateBackDegree =  num::RAND32::Instance().RandFloat( 100,170);
	m_RotateBackClockWise = false;

	if(num::RAND32::Instance().RandInt(0,1) == 0)
	{
		m_RotateBackClockWise = true;
	}


}

void		FIGMiniBossHulk::Tick_GoBack(float dt)
{
	m_Speed += ( 1 * dt);
	GoForward(dt);
	
	if( m_Pos.x < -0.3f || m_Pos.y < 0 || m_Pos.x > 1.3f || m_Pos.y > 1)
		m_IsAlive = false;
}

void	FIGMiniBossHulk::OnShootStyle1()
{
	
	//return;
	FIGEnemyBulletMaster::Instance().Shoot(
											this,
											m_Bone.GetPosByWayPoint(0),
											FIGEnemyBulletMaster::BULLET_TYPE_LONG_CYAN,
											FIGBullet::SHOOT_STYLES_SINGLE,
											0,
											0,
											true,
											NULL
          									);

	FIGEnemyBulletMaster::Instance().Shoot(
											this,
											m_Bone.GetPosByWayPoint(1),
											FIGEnemyBulletMaster::BULLET_TYPE_LONG_CYAN,
											FIGBullet::SHOOT_STYLES_SINGLE,
											0,
											0,
											true,
											NULL
          									);
}


